package com.fwmagic.flink.streaming

import org.apache.flink.api.scala._
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}

import org.apache.flink.streaming.api.windowing.time.Time
object TestMaxBy {
  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    env.setParallelism(1)
    val dataStream: DataStream[(String, Int)] = env.fromElements(("a",5),("b",4),("c",3),("d",2),("e",1))
    val res: DataStream[(String, Int)] = dataStream.keyBy(0).maxBy(1)
    res.print()
    env.execute()
  }

}
